dirname "$0"
$0
のディレクトリ部分を抽出する
例えば、スクリプトが
/home/user/scripts/myscript.sh
であれば、
dirname
は
/home/user/scripts
を返す